using System;
using System.Collections.Generic;


namespace Framework
{
    public static class IdGenerater
    {
        public static int s_GenerateId = 0;
        public static Dictionary<string, int> s_Name2Id = new Dictionary<string, int>();

        public static int GenerateId(string name = null)
        {
            if (name == null)
            {
                return ++s_GenerateId;
            }
            int re;
            if (!s_Name2Id.TryGetValue(name, out re))
            {
                re = 0;
            }
            s_Name2Id[name] = ++re;
            return re;
        }
    }
}